using System;
using System.Collections.Generic;
using System.Text;
using NewtonDynamics;

namespace WPFPhysics1
{
	public class Transform2D : IDisposable
	{
		private CBody body;
		private EventHandler<CSetTransformEventArgs> setTransformHandler = new EventHandler<CSetTransformEventArgs>( Body_SetTransform );

		public Transform2D( CBody body )
		{
			this.body = body;
			body.SetTransform += setTransformHandler;
		}

		#region IDisposable Members

		public ~Transform2D()
		{
			Dispose( true );
		}

		public void Dispose()
		{
			Dispose( false );
		}

		private void Dispose( bool disposing )
		{
			if ( body != null )
			{
				body.SetTransform -= setTransformHandler;
			}
		}

		#endregion
	}
}
